package eu.jakubiak.mcc.enums;

import java.util.EnumSet;



public enum Status {
    UPLOADED("uploaded"), 
    CONVERTED("converted"), 
    DELETED("deleted"), 
    ERROR("error");

    private String statusString;

    private Status(String statusString) {
        this.statusString = statusString;
    }

    /**
     * Checking if given status is my status
     * 
     * @param testString
     * @return
     */
    private boolean test(String testString) {
        return statusString.equals(testString);
    }

    /**
     * Searching for status
     * 
     * @param testString
     * @return
     */
    public static Status find(String testString) {
        for (Status status : EnumSet.allOf(Status.class)) {
            if (status.test(testString)) {
                return status;
            }
        }
        return null;
    }

}
